package com.online.service;

import com.online.dao.UserMapper;
import com.online.entity.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class UserServiceImpl implements UserService {

    @Autowired
    UserMapper userMapper;

    @Override
    public User showByid(Integer id) {
        return userMapper.selectUserById(id);
    }

    @Override
    public User showUserByUserNumber(String userNumber) {
        return userMapper.selectUserByUserNumber(userNumber);
    }

    @Override
    public Integer showStatusByUserNumber(String userNumber) {
        return userMapper.selectStatusByUserNumber(userNumber);
    }

    @Override
    public String showRoleByUserBumber(String userNumber) {
        return userMapper.selectRoleByUserNumber(userNumber);
    }

    @Override
    public int addARecord(User user) {
        return userMapper.insertARecord(user);
    }

    @Override
    public int deleteAUserByUserNumber(String userNumber) {
        return userMapper.deleteUserByUserNumber(userNumber);
    }

    @Override
    public int updateUserByUserNumber(String userNumber, String password) {
        return userMapper.updateUserByUserNumber(userNumber,password);
    }

    @Override
    public int updateUserStatus(String userNumber, Integer status) {
        return userMapper.updateStatus(userNumber,status);
    }
}
